@extends('layouts.default') @section('main')
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a>
                <a href="{{url('ztc/list')}}" class="tip-bottom">直通车管理</a>
                <a href="#" class="current">直通车信息修改</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span9">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>直通车管理</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form action="{{url('ztc/edit')}}" id="adForm" method="post" class="form-horizontal">
                                <div class="control-group">
                                    <label class="control-label">直通车ID :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="id" value="{{$list->id}}" readonly="readonly"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">投资人 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="nickname" value="{{$list->user->nickname?$list->user->nickname:$list->user->realname}}" readonly="readonly"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>直通车状态 :</label>
                                    <div class="controls">
                                        <input type="radio"  name="status"  value="1" @if($list->status==1)checked="checked"@endif/>可预约
                                        <input type="radio"  name="status"  value="0" @if($list->status==0)checked="checked"@endif/>不可预约
                                        <input type="radio"  name="status"  value="-1" @if($list->status==-1)checked="checked"@endif/>禁用
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>投资人简介 :</label>
                                    <div class="controls">
                                        <textarea  class="textarea_editor span11" rows="5" name="intro" >{{$list->intro}}</textarea>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>时间段简介 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="time_intro" value="{{$list->time_intro}}"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">直通车图片 :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="image"
                                               placeholder="直通车图片" value="{{$list->image}}"  />
                                        <img src="{{getImage($list->image)}}" width="120px" name="image" height="120px"/>
                                        <a href="javascript:void(0);" id="uploadWxphotoBtn"  onclick="javascript:openBrowse('uploadWxphotoBtn','uploadWxphoto');">点击上传</a>
                                        <input type="file" id="uploadWxphoto" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadWxphoto','image')"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>时间段是否可协商 :</label>
                                    <div class="controls">
                                        <input type="radio"  name="time_type"  value="1" @if($list->time_type==1)checked="checked"@endif/>可协商
                                        <input type="radio"  name="time_type"  value="0" @if($list->time_type==0)checked="checked"@endif/>不可协商
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">直通车使用次数 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="apply_count" value="{{$list->apply_count}}"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>直通车类型 :</label>
                                    <div class="controls">
                                        <input type="radio"  name="type"  value="new" @if($list->type=='new')checked="checked"@endif/>最新
                                        <input type="radio"  name="type" value="hot" @if($list->type=='hot')checked="checked"@endif />最热
                                        <input type="radio"  name="type" value="follow" @if($list->type=='follow')checked="checked"@endif/>值得关注
                                        <input type="radio"  name="type" value="authority" @if($list->type=='authority')checked="checked"@endif/>权威
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">排序 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="sort" value="{{$list->sort}}"  placeholder="排序" />
                                    </div>
                                </div>
                                <input type="hidden" class="span11" name="formType" value="edit" />
                                <div class="form-actions">
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <button type="button" id="doSave" class="btn btn-success">确认修改</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $("#doSave").click(function(){
            ajaxRequest($('#adForm').serializeArray(),$('#adForm').attr('action'),function(data){
                if(data.status){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });
    </script>
@stop
